﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace ITAP.ShprossesBuilder.Modelling.Measurement
{
    public class BoundingBoxHelper
    {
        private List<RectangleF> boundingBoxes;
        public BoundingBoxHelper()
        {
            boundingBoxes = new List<RectangleF>();
        }
        public void Add(RectangleF boundingBox)
        {
            boundingBoxes.Add(boundingBox);
        }
        public void Clear()
        {
            boundingBoxes.Clear();
        }
        public RectangleF GetUnionBoundingBox()
        {
            RectangleF result = RectangleF.Empty;
            if (this.boundingBoxes.Count != 0)
                result = this.boundingBoxes[0];            

            foreach (RectangleF rect in this.boundingBoxes)
                result = RectangleF.Union(result, rect);
            return result;
        }
    }
}
